package com.kang.scheduling;


import com.kang.service.DeleteDirectoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
@Slf4j
public class DeleteDirectory {

    @Autowired
    private DeleteDirectoryService deleteDirectoryService;


    @Scheduled(fixedRate = 1000 * 60 * 60* 24) //定时一天
    public void deleteUpload() {
        try {
            deleteDirectoryService.deleteUploadMkdir();
        } catch (Exception ex) {
            log.error("定时删除上传文件夹异常",ex);
        }
    }

}
